package com.ruoyi.project.remake.controller;

import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.framework.web.controller.BaseController;
import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.framework.web.page.TableDataInfo;
import com.ruoyi.project.remake.domain.TCaseMain;
import com.ruoyi.project.remake.domain.TRemakeCaseDetails;
import com.ruoyi.project.remake.domain.query.ReportQuery;
import com.ruoyi.project.remake.domain.vo.ReprotVo;
import com.ruoyi.project.remake.service.ITCaseMainService;
import com.ruoyi.project.remake.service.ITRemakeCaseDetailsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/remake/report")
public class TReportController extends BaseController {

    @Autowired
    private ITRemakeCaseDetailsService tRemakeCaseDetailsService;

    /**
     * 查询病例主表列表
     */
    @PreAuthorize("@ss.hasPermi('remake:report:list')")
    @GetMapping("/list")
    public TableDataInfo list(ReportQuery reportQuery)
    {
        startPage();
        List<ReprotVo> list = tRemakeCaseDetailsService.selectReport(reportQuery);
        return getDataTable(list);
    }
    /**
     * 查询病例主表列表
     */

    @GetMapping("/selectReportDetails")
    public AjaxResult selectReportDetails(ReportQuery reportQuery)
    {
        List<ReprotVo> list = tRemakeCaseDetailsService.selectReportDetails(reportQuery);
        return AjaxResult.success(list);
    }
    /**
     * 查询病例主表列表
     */

    @GetMapping("/exportReportList")
    public AjaxResult exportReportList(ReportQuery reportQuery)
    {
        List<ReprotVo> list = tRemakeCaseDetailsService.selectReportDetails(reportQuery);
        ExcelUtil<ReprotVo> util = new ExcelUtil<ReprotVo>(ReprotVo.class);
        return util.exportExcel(list, "报表详情");
    }


}
